﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GluePathModule
{
    public class GluePathGroup
    {
        public List<GluePathUnit> listGlueUnit;
        public string Name;
        public string strRemark;
        public GluePathGroup()
        {
            listGlueUnit = new List<GluePathUnit>();
            Name = "";
            strRemark = "";
        }
        public void GetMinMaxXY(out double dMinX, out double dMinY, out double dMaxX, out double dMaxY)
        {
            dMaxX = -9999;
            dMaxY = -9999;

            dMinX = 9999;
            dMinY = 9999;
            if (listGlueUnit.Count < 1)
                return;
            bool bNeedModify = false;
            for (int i = 0; i < listGlueUnit.Count; i++)
            {
                GluePathUnit gluePathUnit = listGlueUnit[i];
                if (gluePathUnit.listContinueItems.Count > 0)
                {
                    
                    bNeedModify = true;
                }
            }
            
        }
        public List<MotionItemBase> GetMotionList(double dOffSetZ)
        {
            List<MotionItemBase> motionItems = new List<MotionItemBase>();
            for (int i = 0; i < listGlueUnit.Count; i++)
            {
                GluePathUnit gluePathUnit = listGlueUnit[i];
                if (gluePathUnit.listContinueItems.Count > 0)
                {
                    for (int j = 0; j < gluePathUnit.listContinueItems.Count; j++)
                    {
                        gluePathUnit.listContinueItems[j].PushItem(motionItems,this, gluePathUnit, j, dOffSetZ);
                    }
                }
            }
            return motionItems;

        }

        public GluePathGroup Copy()
        {
            GluePathGroup gluePathGroupCopy = new GluePathGroup();
            gluePathGroupCopy.Name = "GluePathGroup" + (GluePathManager.gluePathCenter.listGluePathGroup.Count + 1).ToString();
            for (int i = 0; i < listGlueUnit.Count; i++)
            {
                GluePathUnit gluePathUnit = listGlueUnit[i].CopyUnit();
                gluePathGroupCopy.listGlueUnit.Add(gluePathUnit);
            }
            return gluePathGroupCopy;
        }
    }
}
